﻿using System;
using System.Collections.Generic;
using System.Linq;
using Products.Domain.SubProducts;

namespace Products.Domain.Products
{
    public class Produce
    {
        public virtual Guid Id { get; protected set; }
        public virtual string ProductName { get; protected set; }
        public virtual string Description { get; protected set; }
        public virtual decimal Price { get; protected set; }
        public virtual string AdditionalDescription { get; protected set; }
        private IList<SubProduct> _subProducts;
        public virtual IEnumerable<SubProduct> SubProducts { get { return _subProducts; } }

        public Produce(IEnumerable<SubProduct> subProducts, Guid id, string productName, string description, decimal price, string additionalDescription)
        {
            _subProducts = subProducts.ToList();
            Id = id;
            ProductName = productName;
            Description = description;
            Price = price;
            AdditionalDescription = additionalDescription;
        }

        [Obsolete("For NHibernate usage only")]
        public Produce()
        {
            
        }

        public virtual void ChangePrice(decimal newPrice)
        {
            Price = newPrice;
        }

        public virtual void MagicalBuisnessMethod()
        {
            //Here should be a very magical code...
        }
    }
}
